package com.java复习.demo1;

import java.util.List;

public class Dog {
    private String name;
    private int age;
    public List list;


    //构造方法---1、创建对象，2、完成资源的初始化，3、用于传参
    public Dog(String name,int age){
        this.name=name;
        this.age=age;

        System.out.println("用于创建对象实例");
    }

    //Dog方法重载
    public Dog(List list){
        list.add("肉");
        list.add("狗粮");
        this.list = list;
    }

    public void showlist(){
        System.out.println(list);
    }
}
